package com.u2ds.core.config;

import com.cybermkd.mongo.kit.MongoKit;
import com.cybermkd.mongo.plugin.MongoPlugin;
import com.mongodb.MongoClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by Ethan.Yuan on 2017/5/16.
 */
@Configuration
public class TkMapperConfig {

    @Bean
    public MongoPlugin mongoPlugin(){
        MongoPlugin mongoPlugin = new MongoPlugin();
        mongoPlugin.add("127.0.0.1", 27017);
        mongoPlugin.setDatabase("badminton");
        MongoClient client = mongoPlugin.getMongoClient();
        MongoKit.INSTANCE.init(client, mongoPlugin.getDatabase());
//        client.close();
        return mongoPlugin;
    }
}
